[id].vue 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div id="newsList">
  3. <!-- 头部 -->
  4. <templateHead></templateHead>
  5. <!-- 菜单 -->
  6. <templateMenu></templateMenu>
  7. <div>
  8. <!--广告组件 农民网-->
  9. <templateAd :adTag="'nmw_search_0001'" :skinId="skinId" :adData="adData"></templateAd>
  10. <!--搜索组件-->
  11. <templateSearch :skinId="skinId" :templateData="testTemplateData"></templateSearch>
  12. <!--广告组件 农民网-->
  13. <templateAd :adTag="'nmw_search_0002'" :skinId="skinId" :adData="adData"></templateAd>
  14. </div>
  15. <!-- 底部 -->
  16. <templateFoot></templateFoot>
  17. </div>
  18. </template>
  19. <script setup>
  20. //0.加载全局模板组件 start---------------------------------------->
  21. //0.1 全局通栏
  22. import templateHead from '@/components/template/sector/head/1200x200/1.vue'
  23. import templateMenu from '@/components/template/sector/menu/1200x130/1.vue'
  24. import templateFoot from '@/components/template/sector/foot/1200x580/1.vue'
  25. //0.2.1 广告组件
  26. import templateAd from '@/components/template/sector/body/ad/1200x90/1.vue'
  27. //0.2.2 搜索组件
  28. import templateSearch from '@/components/template/sector/body/search/list/1200x1300/1.vue'
  29. //0.加载全局模板组件 end---------------------------------------->
  30. //1.获得基本信息单元 start---------------------------------------->
  31. //1.1获得页面依赖
  32. import { ref, onMounted } from 'vue';
  33. //1.2获得pinia源
  34. import { useTemplateBaseStore } from '@/stores/templateBase'
  35. const templateBaseStore = useTemplateBaseStore()
  36. //1.3获得该页的皮肤id - 在每个组件中也是同样的获得方法
  37. const skinId = ref("")
  38. const websiteId = ref("")
  39. //1.4获得站点基本信息
  40. const responseStatus = await requestDataPromise('/web/getWebsiteAllinfo', {
  41. method: 'GET',
  42. query: {
  43. 'link_textnum':24,
  44. 'link_imgnum':18,
  45. 'link_footnum':4
  46. },
  47. });
  48. if (responseStatus.code == 200) {
  49. //0.3.1设置站点基本信息
  50. templateBaseStore.setWebSiteInfo(responseStatus.data)
  51. websiteId.value = responseStatus.data.website_head.id;//获得网站id
  52. //0.3.2设置皮肤id
  53. skinId.value = templateBaseStore.webSiteInfo.website_foot.foot_info.template_id;
  54. console.log("当前的网站id:"+responseStatus.data.website_head.id)
  55. //0.3.3设置seo信息
  56. let seoTitle = templateBaseStore.webSiteInfo.website_head.title;
  57. let seoDescription = templateBaseStore.webSiteInfo.website_head.description;
  58. let seoKeywords = templateBaseStore.webSiteInfo.website_head.keywords;
  59. let seoSuffix = templateBaseStore.webSiteInfo.website_head.suffix;
  60. let seoName = templateBaseStore.webSiteInfo.website_head.website_name;
  61. useSeoMeta({
  62. title: seoTitle + "_" + seoSuffix,
  63. meta: [
  64. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  65. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 }
  66. ]
  67. });
  68. }
  69. //1.5获得广告池
  70. const adData = ref([]);
  71. const adResponseStatus = await requestDataPromise('/web/getWebsiteAdvertisement', {
  72. method: 'GET',
  73. query: {},
  74. });
  75. if (adResponseStatus.code == 200) {
  76. adData.value = adResponseStatus.data;
  77. templateBaseStore.setAdList(adResponseStatus.data)
  78. }
  79. //1.获得基本信息单元 end---------------------------------------->
  80. </script>
  81. <style lang="less" scoped>
  82. </style>